package org.wat.wcy.isi.mmazur.bp.io.model.temporary;

import org.apache.commons.lang.StringUtils;
import org.wat.wcy.isi.mmazur.bp.io.model.IdDesc;

public class Route {
	private String from, to;

	public Route(String from, String to) {
		super();
		this.from = from != null ? from : IdDesc.ID_NULL;
		this.to = to != null ? to : IdDesc.ID_NULL;
	}
	
	public Route() {
		this(IdDesc.ID_NULL, IdDesc.ID_NULL);
	}
	
	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}

	public String toString() {
		return from + "->" + to;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Route) {
			Route route = (Route)obj;
			boolean ret = StringUtils.equalsIgnoreCase(from, route.getFrom().toString());
			ret &= StringUtils.equalsIgnoreCase(to, route.getTo().toString());
			return ret;
		}
		return false;
	}

	@Override
	public int hashCode() {
		String str = from.replace("-", "") + to.replace("-", "");
		return str.hashCode();
	}
}
